package com.ruoyi.gis.mapper;

import com.ruoyi.gis.domain.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface YcGroupLayerRptMapper {

    @Select("<script>" +
            " select " +
            " layer_name as layerName,layer_code as layerCode,group_type as groupType,x_name as xName" +
            ",yp_qdhl_value as ypQdhlValue,yp_qlhl_value as ypQlhlValue,yp_sxjhl_value as ypSxjhlValue" +
            ",jg_qdhl_value as jgQdhlValue,jg_qlhl_value as jgQlhlValue,jg_sxjhl_value as jgSxjhlValue" +
            ",y_order as yOrder  from yc_group_layer_rpt " +
            " where " +
            " layer_code = #{groupName} " +
            " order by y_order" +
            "</script>"
    )
    List<YcGroupLayerRpt> selectDLJListByGroupName(@Param("groupName")String groupName);

    @Select("<script>" +
            " select " +
            " layer_name as layerName,layer_code as layerCode,group_type as groupType,x_name as xName" +
            ",y_value as yValue" +
            ",y_order as yOrder  from yc_wh_data " +
            " where " +
            " layer_code = #{groupName} " +
            " order by y_order" +
            "</script>"
    )
    List<YcGroupLayerRpt> selectWHListByGroupName(String groupName);

    @Select("<script>" +
            " select " +
            " group_pcode as groupPCode,group_pname as groupPName" +
            ",sum(sb_mj_value) as sbMjValue" +
            " from yc_mj_data" +
            " where " +
            " group_pcode in " +
            " <foreach collection='groupPCodes' item='code' open='(' separator=',' close=')'>" +
            "#{code} " +
            " </foreach>" +
            " group by group_pcode,group_pname " +
            "</script>"
    )
    YcMjData selectMjDataByGroupCode(@Param("groupPCodes")List<String> groupPCodes);

    @Select("<script>" +
            " select " +
            " sum(sb_mj_value) as sbMjValue" +
            " from yc_mj_data" +
            " where " +
            " group_code in " +
            " <foreach collection='groupCodes' item='code' open='(' separator=',' close=')'>" +
            "#{code} " +
            " </foreach>" +
            "</script>")
    YcMjData selectMjDataByProductCode(@Param("groupCodes")List<String> groupCodes);

    @Select("<script>" +
            " select " +
            " province,nf,concat(mj,'') as mj" +
            " from yc_province_data" +
            " where nf = #{strNf}" +
            " order by mj desc" +
            "</script>")
    List<YcProvinceData> selectProvinceMjDataByNf(@Param("strNf")String strNf);

    @Select("<script>" +
            " select id,layer_name as layerName,group_type as groupType,x_name as xName,y_order as yOrder,layer_code as layerCode" +
            " ,zg_value as zgValue,gjc_value as gjcValue,ymj_value as ymjValue,yxz_value as yxzValue,jxz_value as jxzValue" +
            " ,gxz_value as gxzValue,ygz_value as ygzValue,jgz_value as jgzValue,ggz_value as ggzValue" +
            " ,dsbxz_value as dsbxzValue,dsbgz_value as dsbgzValue,md_value as mdValue,ymjzs_value as ymjzsValue" +
            " ,dsbxzzs_value as dsbxzzsValue,dsbgzzs_value as dsbgzzsValue" +
            " from yc_bx_data" +
            " where layer_code = #{layerCode}" +
            " and x_name = #{xName}" +
            " order by x_name, group_type asc" +
            "</script>")
    List<YcBxData> selectDkBxList(@Param("layerCode")String layerCode,@Param("xName")String xName);

    @Select("<script>" +
            " select id,qy_name as qyName,qy_code as qyCode" +
            " ,sf_name as sfName,sf_code as sfCode,nf" +
            " ,bozhong_type as bozhongType,bozhong_type_code as bozhongTypeCode" +
            " , mj_value as mjValue" +
            " from yc_qgbz_mj_data" +
            " where nf = #{strNf}" +
            " order by qy_name,sf_name,nf,bozhong_type desc" +
            "</script>")
    List<YcQgbzMjData> selectYcRptQgMjByNf(String strNf);
}
